package com.abc.config;


import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource;
import org.tuckey.web.filters.urlrewrite.UrlRewriteFilter;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

@Configuration
public class CustomerFilter {

    @Bean
    public FilterRegistrationBean tuckeyRegistrationBean() {
        final FilterRegistrationBean registrationBean = new FilterRegistrationBean();

        registrationBean.setFilter(new CustomURLRewriter());
        String fileName = "urlrewirte.xml";
        ClassPathResource classPathResource = new ClassPathResource(fileName);

        registrationBean.addInitParameter("confPath", classPathResource.getFilename());

        return registrationBean;
    }
}